package com.mmr.dxp.mapper;

import com.mmr.dxp.domain.OrganInfo;
import com.mmr.dxp.domain.RdsResourceObject;
import com.mmr.dxp.domain.RdsSourceSub;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface RdsSourceSubMapper {
    @Select("SELECT ID,RESOURCE_ID,SUB_ORG_CODE FROM RDS_SOURCE_SUB WHERE ID = #{id}")
    @Results(id = "rdsSourceSubMap", value = {
            @Result(column = "id", property = "id", jdbcType = JdbcType.VARCHAR, id = true),
            @Result(column = "RESOURCE_ID", property = "resource", javaType = RdsResourceObject.class,
                    one = @One(select = "com.tongtech.blockchain.dxp.mapper.RdsResourceMapper.selectByPrimaryKey")),
            @Result(column = "SUB_ORG_CODE", property = "organInfo", javaType = OrganInfo.class,
                    one = @One(select = "com.tongtech.blockchain.dxp.mapper.OrganInfoMapper.selectByCode"))
    })
    RdsSourceSub selectByPrimaryKey(String id);
}
